$projectFolder = (Get-Item -Path "../src" -Verbose).FullName

Get-ChildItem -Path $projectFolder -Directory |
ForEach-Object {
    $existsBin = Test-Path -Path ($_.FullName + "\bin")
    IF ($existsBin) {
        $binDir = $_.FullName + "\bin"
        Write-Host $binDir
        Remove-Item $binDir -Recurse
    }

    $existsBin = Test-Path -Path ($_.FullName + "\obj")
    IF ($existsBin) {
        $objDir = $_.FullName + "\obj"
        Write-Host $objDir
        Remove-Item $objDir -Recurse
    }
    
    $csproj = $_.FullName + "\*.csproj"
    Get-ChildItem -Path $csproj |
    ForEach-Object {
        dotnet build --configuration Release $_.FullName       
    }
}
